package org.hu.mapper;

import org.apache.ibatis.annotations.*;
import org.hu.entity.pojo.Category;

import java.util.List;

@Mapper
public interface CategoryMapper {
    // 新增一个分类
    @Insert("insert into category(name,create_time,update_time) " +
            "values " +
            "(#{name},#{createTime},#{updateTime})")
    void insert(Category category);

    // 删除一个分类
    @Delete("delete from category where id = #{id}")
    void deleteById(Integer id);

    // 修改一个分类
    @Update("update category set name=#{name},update_time=#{updateTime},status=#{status} where id=#{id}")
    void updateById(Category category);

    // 查询所有分类
    @Select("select * from category")
    List<Category> select();
}
